﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Entity;
using Utils.DC.Web.UI;

public partial class Admin_Pages_AdminEdit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["login"] != null)
            {
                lblUser.Text = Request.Params["username"];
            }
            else
            {
                Response.Redirect("../Login.aspx");
            }
            
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        AdminUI adminUI=new AdminUI();
        int result=adminUI.Edit(lblUser.Text.Trim(),Security.Encrypt(txtRePass.Text.Trim()));
        if(result>0) 
        {
            Response.Write("<script>alert('Edit successful'); window.location='../Pages/AdminList.aspx';</script>");
        }else
        {
            Response.Write("<script>alert('Edit fail');</script>");
        }
    }
}
